<?php
  	class Model_index extends CI_Model{
		protected $_table = "tbl_intro_one";
		protected $_cate = "tbl_category";
		protected $_cago = "tbl_categories";
		protected $_tours  = "tbl_tours";
		protected $_menu = "tbl_menu";
		protected $_intro = "tbl_intro";		
		protected $_product ="tbl_products";
		//protected $_contact ="tbl_contact_info";
		protected $_contact ="tbl_contact";						
		protected $_post = "tbl_posts";						
		protected $_config ="tbl_config";
		protected $_service ="tbl_services";
		protected $_cruise ="tbl_cruises";	
		protected $_request ="tbl_request";						
		public function __construct(){
			parent::__construct();
			$this->load->database();
		}
		public function config(){
			$this->db->where("config_id","1");
			return $this->db->get($this->_config)->row_array();
		}
		public function getcate($id){
			$this->db->where("cate_id",$id);
			return $this->db->get($this->_cate)->row_array();
		}
		public function getcago($id,$limit){
			$this->db->where("cate_id",$id);
			$this->db->limit($limit);
			return $this->db->get($this->_cago)->result_array();
		}
		public function getpackage($cago_id){
			$this->db->where("cago_id",$cago_id);
			$this->db->limit(4);
			return $this->db->get($this->_tours)->result_array();
		}
		public function getpacktop($id){
			$this->db->where("cate_id",$id);
			$this->db->limit(4);
			$this->db->order_by("tour_id","RANDOM");
			return $this->db->get($this->_tours)->result_array();
		}
		public function intro(){
			$this->db->order_by("in_order","ASC");
			return $this->db->get($this->_intro)->result_array();
		}
		public function deal(){
			$this->db->where("tour_show",1);
			$this->db->order_by("tour_id","RANDOM");
			$this->db->limit(1);
			return $this->db->get($this->_tours)->row_array();
		}
		public function hlcruise(){
			$this->db->where("cate_id",88);
			$this->db->limit(10);
			return $this->db->get($this->_cruise)->result_array();
		}
		public function add_request($data){
			$this->db->insert($this->_request,$data);
		}
	}